
#include<string.h>

int getLucky(char *s, int k)
{
    int sums = 0;
    for (int i = 0; s[i]; ++i)
        sums += (s[i] - 60) / 10 + (s[i] - 60) % 10;
    for (int i = 0; i < k - 1; ++i)
    {
        int sumsnew = 0;
        while (sums)
        {
            sumsnew += sums % 10;
            sums /= 10;
        }
        sums = sumsnew;
    }
    return sums;
}